local blaze = require "blaze"
local app = require "app"

local lib = blaze.app.new({
    modules = {
        ["seat"] = "club.threecard.slotlib.seat",
        ["machine"] = "club.threecard.slotlib.machine",
        ["line"] = "club.threecard.slotlib.line",
        ["systems"] = "club.threecard.slotlib.systems",
        ["components"] = "club.threecard.slotlib.components",
        ["frame_type"] = "club.threecard.slotlib.frame_type"

    },
    require = function(path)
        return require("club.threecard.slotlib." .. path)
    end,
    on_splashscreen = blaze.noop,
    on_start = function(self)
        local lang = app.store.setting.state.lang
        local db = blaze.config.load(string.format("club/threecard/slotlib/i18n/%s.lua", lang))
        app.i18n.add("club.threecard.slotlib", db)

        local bank = app.audio.create_bank(app, "club.threecard.slotlib", {
            actions = require("blaze.audio.actions"),
            soundbank = blaze.config.load("club/threecard/slotlib/soundbank.lua")
        })
        app.audio.add_bank(bank)

        local game = app.game.running
        game.kbe.register("SlotPlayer", "club.threecard.slotlib")
        game.kbe.register("SlotRoom", "club.threecard.slotlib")
        game.store.add_searcher("club.threecard.slotlib")
    end,
    on_exited = function(self)
        app.audio.remove_bank("club.threecard.slotlib")
        app.i18n.remove("club.threecard.slotlib")

        local game = app.game.running
        game.store.remove_searcher("club.threecard.slotlib")
    end
})
return lib
